package com.apes.fico.finance.respository;

import com.apes.fico.finance.model.costcollect.OperatingCosts;
import com.apes.fico.finance.model.costcollect.TypeCost;
import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.masterdata.frame.model.Dept;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface OperatingCostsRepository extends CustomRepository<OperatingCosts, String> {

    @Query(value = "SELECT * FROM GL_OPERATING_COSTS A " +
            "WHERE EXTRACT(MONTH FROM A.YEAR_MONTH) = :months " +
            "AND EXTRACT(YEAR FROM A.YEAR_MONTH) = :years " +
            "AND A.TYPE_COST = :typeCostId " +
            "AND A.COMPANY_ID = :companyId " +
            "AND A.DEPT_ID = :deptId"
            ,nativeQuery = true)
    List<OperatingCosts> findOldOperatingCosts(@Param("months") String months, @Param("years") String years, @Param("deptId") String deptId, @Param("typeCostId") String typeCostId, @Param("companyId") String companyId);
}
